home *** CD-ROM | disk | FTP | other *** search
/ Developer Source 17 / Developer Source Volume 17 (I-MODE Publications, Inc.)(2000).iso / visua / feb98 / swanf107.gif < prev    next >
Graphics Interchange Format  |  1998-06-08  |  34KB  |  600x560  |  4-bit (4 colors)
Labels: text | screenshot | font | number | black and white | parallel | document
OCR: Method Description void addNotify As with similarly named methods scattered throughout the AWT package, this method oftaches a MenuBar object to the operating system's native peer. There is rarely any good reason for an application to call this method void remove Notify This detaches the MenuBar object from its native peer. Calling removeNotify also detaches all menus from their peers (which detaches the individual menu items as well). If you are writing system software, or if you are doing your own menu class- es, you can call this method to detach an entire menu bar and all its elements. Applications, however, should have no reason to call this method. Menu getHelpMenu Returns the Menu object that is currently designated as the Help menu. If there is no such menu, gefHelpMenu returns noll. void setHelpMenu(Menu m) Sets the current Help menu. This changes an internal helpMenu flag to true for the HelpMenu-class object, which is maintained as an instance variable in MenuBar. The flag is possed to the peer, which might use it to display the Help [menu differently, or perhaps in a different location on the menu bar, depending on the native operating system's characteristics. To take advantage of these fea fures; call setHelpMenu for your menu's Help Menu object: This might, however, do absolutely nothing if the operating system does not treat Help menus differ- ently from others. Menu add(Menu m) Adds a new Menu object to the menu bar. Notice that this method returns the same object passed as an argument, which might be useful for debugging but otherwise seems to have little practical value: Internally, Menu objects are stored In the MenuBar class in an object of the Vector class, and are added by calling thot class' addElement method. Unlike the Menu class' add methods, however, Menubar.odd does not first remove the Menu argument object, an unfortunate inconsistency in Java's menu-class design. For this reason, you must take care nof to add the same Menu object to a MenuBar twice by accident, an error the class does nothing to prevent, void removefint index) Removes the specified Menu item from the menu bar. Menus are numbered from left to right starting with zero. void remove(MenuComponent m) | Removes the specified MenuComponent object (usually a Menu object) from the menu bar. Use this overloaded form of remove if your code maintains a reference to its popup menus; otherwise, use the preceding indexed method. int countMenus Returns the number of Menu objects in this MenuBar. This equals the internal Vector's size return value. Menu getMenu(int I) Returns the Menu item at the specified index. Menus are numbered from left to right starting with zero. Figure 7: MenuBor's public methods.